<?php
namespace app\admin\model\goods;
use think\facade\Db;
use app\admin\common;

class Goods{
		
	public function insertGoods($_data){
		return Db::name("shop_goods")->insert($_data,true);
	}
	
	public function editGoods($_up,$_where){
		return Db::name("shop_goods")->where($_where)->update($_up);
	}
	
	public function findGoods($_where,$_field){
		return Db::name("shop_goods")->where($_where)->field($_field)->find();
	}
	
	public function selectGoods($_where,$_field,$_limit,$_order){
		$_data=Db::name("shop_goods")->where($_where)->field($_field)->limit(current($_limit),end($_limit))->order($_order)->select();
		return empty($_data)?:$_data->toArray();
	}
	
	public function insertGoodsDetails($_data){
		return Db::name("shop_goods_details")->insert($_data,true);
	}
	
	public function editGoodsDetails($_up,$_where){
		return Db::name("shop_goods_details")->where($_where)->update($_up);
	}
	
	
	public function findGoodsDetails($_where,$_field)
	{
		return Db::name("shop_goods_details")->where($_where)->field($_field)->find();
	}
	
	public function selectGoodsDetails($_where,$_field,$_order="id asc"){
		$_data=Db::name("shop_goods_details")->where($_where)->field($_field)->order($_order)->select();
		return empty($_data)?:$_data->toArray();
	}
}
?>